from django.db import models
# 用户表
class User(models.Model):
    username=models.CharField(max_length=100)
    password=models.CharField(max_length=100)
# 部门表
class bumentable(models.Model):
    buname=models.CharField(max_length=100)
    sjbmid=models.ForeignKey("self",null=True,on_delete=models.SET_NULL,related_name="child")
    create_time=models.DateTimeField()
# 员工表
class yuangtable(models.Model):
    ygname=models.CharField(max_length=100)
    subm=models.ForeignKey(bumentable,on_delete=models.CASCADE,related_name="child1")
    price=models.DecimalField(max_digits=10,decimal_places=2)
    ruday=models.DateTimeField()
    ygbh=models.CharField(max_length=100,unique=True)
    zaizhistatus=models.BooleanField(default=True)
# 考勤记录表
class kaoqin(models.Model):
    ygid=models.ForeignKey(yuangtable,on_delete=models.CASCADE,related_name="child2")
    kqday=models.DateTimeField()
    kqtype=models.IntegerField(choices=[(1,"正常"),(2,"迟到"),(3,"早退"),(4,"缺勤")])
    beizhu=models.TextField(max_length=100)
